<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
        3个方法：change把public的identify的值修改为identify2
        identify1 打印id值
        identify2 把id值转化为大写的值
        */

        let coolModule = function (id) {
            function identify1() {
                console.log(id);
            }
            function identify2() {
                console.log(id.toUpperCase());
            }
            let publicAPI = {
                change: change,
                identify: identify1
            }
            function change() {
                publicAPI.identify = identify2
            }
            return publicAPI
        }
        let foo = coolModule('aaa')
        foo.identify() // 'aaa'
        foo.change()
        foo.identify() // 'AAA'
    </script>
</body>

</html>